import java.util.LinkedList;


public class LZNode {
	private LinkedList<Character> 	letters	=new LinkedList<Character>();
	private LinkedList<LZNode>		sons	=new LinkedList<LZNode>();
	public 	int myIndex;

	
	public LZNode(int numOfNodes){
		myIndex=numOfNodes;
	}
	
	public void addChild(char c,int nextIndex){
		letters.add(c);
		sons.add(new LZNode(nextIndex));
	}
	
	public LZNode getChild(char c){
		int ind=letters.indexOf(c);
		if (ind>=0)
			return sons.get(ind);
		else
			return null;
	}
}
